<?php
ini_set('max_execution_time', 0);
set_time_limit(0);
ini_set('memory_limit', '-1');

$db=mysql_connect('localhost', 'root', 'Gl-1114');
mysql_select_db('autoinformator', $db);

while (1>0) {
    
    $result = mysql_fetch_assoc(mysql_query("SELECT       UNIX_TIMESTAMP(NOW()) AS `now`
                                             FROM 	      `scheduled_calls`
                                             WHERE	      `scheduled_calls`.datetime = UNIX_TIMESTAMP(NOW())
                                             LIMIT        1"));
    
    if (!empty($result)) {
        
        shell_exec('php -q /var/www/autocall/index.php > /dev/null &');
        
        $log = time()."---check-OK\n";        
        file_put_contents("logs/callsTime.txt", $log, FILE_APPEND);
             
    }
  
    sleep(1);
    
}

?>
